package com.hema.auction.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.widget.TextView;

import com.hema.auction.R;
import com.hema.auction.adapter.FragAdapter;
import com.hema.auction.base.BaseActivity;
import com.hema.auction.fragment.PropertyDetailFragment;
import com.hema.auction.utils.Utils;
import com.hema.auction.widget.view.TitleView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 我的财产
 * author by john
 */

public class MyPropertyActivity extends BaseActivity {

    @BindView(R.id.title_view)
    TitleView titleView;
    @BindView(R.id.tablayout)
    TabLayout tablayout;
    @BindView(R.id.view_pager)
    ViewPager viewPager;
    @BindView(R.id.tv_p_balance)
    TextView tvPBalance;
    @BindView(R.id.tv_z_balance)
    TextView tvZBalance;
    @BindView(R.id.tv_g_balance)
    TextView tvGBalance;
    private String[] title = new String[]{"全部", "收入", "支出"};
    List<Fragment> fragments = new ArrayList<>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_property);
        ButterKnife.bind(this);
        init();
    }

    private void init() {
        fragments.add(PropertyDetailFragment.newInstance(1));
        fragments.add(PropertyDetailFragment.newInstance(2));
        fragments.add(PropertyDetailFragment.newInstance(3));
        FragAdapter fragAdapter = new FragAdapter(getSupportFragmentManager(), fragments, title);
        viewPager.setAdapter(fragAdapter);
        tablayout.setupWithViewPager(viewPager);
        tvZBalance.setText(Utils.isEmpty(profileInfo.getzBalance()) ? "0" : profileInfo.getzBalance());
        tvPBalance.setText(Utils.isEmpty(profileInfo.getpBalance()) ? "0" : profileInfo.getpBalance());
        tvGBalance.setText(Utils.isEmpty(profileInfo.getgBalance()) ? "0" : profileInfo.getgBalance());
    }

}
